
project(LandBase)

file(GLOB INCS inc/*.h)
file(GLOB HEADERS src/*.h)
file(GLOB SOURCES src/*.c)
add_library(land_base
    ${INCS}
    ${SOURCES}
    ${HEADERS}
    )

target_include_directories(land_base PRIVATE src)
target_include_directories(land_base PUBLIC inc)
if(BUILD_SHARED_LIBS)
    target_compile_definitions(land_base PUBLIC LAND_BASE_EXPORTS)
endif()

if(LAND_SOCKETPOLL_USE_SELECT)
    target_compile_definitions(land_base PUBLIC LAND_SOCKETPOLL_USE_SELECT)
endif()

if(WIN32)
    target_compile_definitions(land_base PUBLIC WIN32)
    target_compile_definitions(land_base PRIVATE _CRT_SECURE_NO_WARNINGS)
    target_compile_definitions(land_base PRIVATE _CRT_NONSTDC_NO_DEPRECATE)
endif()

if(LINUX)
    target_compile_definitions(land_base PUBLIC LINUX)
    target_link_libraries(land_base PUBLIC pthread)
    target_link_libraries(land_base PUBLIC m)
    set_target_properties(land_base PROPERTIES COMPILE_FLAGS -std=gnu99)
endif()

if(APPLE)
    target_compile_definitions(land_base PUBLIC APPLE)
    target_link_libraries(land_base PUBLIC pthread)
endif()

